﻿using System.Windows;
using System.Windows.Input;
using MDCAdminTool.Reports;

namespace MDCAdminTool.Commands
{
    public class CacheNameStats : AddCartTabCommandBinding
    {
        public CacheNameStats()
        {
            Command = Application.Current.Resources["CacheNameStats"] as ICommand;
        }

        protected override void OnCanExecute( object sender , CanExecuteRoutedEventArgs e )
        {
            e.CanExecute = true;
        }
        protected override void OnExecuted( object sender , ExecutedRoutedEventArgs e )
        {
            var cache = e.Parameter as MdcCache;
            if ( cache != null )
            {
                cache.LoadStatistics();

                AddNewTab(
                    "CacheName Stats" ,
                    typeof( CacheNameStatsChart ) ,
                    cache );
            }
        }
    }
}